#pragma once
#include "Texture.h"
#include "Input.h"
#include "DX9Engine.h"

#define MENU_BUTCNT 3	// Menu button count
#define IGMU_BUTCNT 2	// In game menu button count
#define NUM_BUTTONS MENU_BUTCNT+IGMU_BUTCNT // total button count

class UserInterface
{
private:
	Input*		pInput;
	DX9Engine*	pEngine;
	bool		mbdown[MAX_MOUSEBUT];
	Texture		window;
	Texture		border;
	Texture		menuButton[MENU_BUTCNT];
	Texture		gameButton[IGMU_BUTCNT];
	RECT		borderRect[NUM_BUTTONS];
	int			GEState;
	bool		resume;

public:
	/** User Interface States
	 * {NONE, MENU, IGMENU}
	 */
	enum UIState {MENU, IGMENU, NONE} uis;
	UserInterface(void);
	~UserInterface(void);
	/** Initialize UI */
	void initialize();
	/** Update UI */
	void update();
	/** Render UI */
	void render();
	/** Draw Text */
	void drawText();
	/** Set UIState to MENU */
	void setMenu() {uis = MENU;}
	/** Set UIState to IGMenu */
	void setGame() {uis = IGMENU;}
	/** set UIState to NONE */
	void setNone() {uis = NONE;}
	/** Set GameEngine state */
	void setGEState(int s) {GEState = s;}
	/** Get UI State
	 * 0 = UI_MENU
	 * 1 = UI_INGAME
	 * 2 = UI_NONE
	 */
	int getState();
	/** UI release */
	void release();
	bool isResume()
	{
		if(resume)
		{
			resume = false;
			return true;
		}
		return false;
	}
};